//
//  TouchExampleViewController.m
//  TouchExample
//

#import "TouchExampleViewController.h"

@implementation TouchExampleViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	
	float boxSize = 100.0;
	CGRect redBoxRect = CGRectMake(110,180,boxSize,boxSize);
	redBox = [[UIView alloc] initWithFrame:redBoxRect];
	redBox.backgroundColor = [UIColor redColor];
	[self.view addSubview:redBox];
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
	UITouch *touch = [[event touchesForView:redBox] anyObject];
	CGPoint currentPoint = [touch locationInView:self.view];
	
	[touch view].center = currentPoint;
}

- (void)dealloc {
	[redBox release];
	redBox = nil;
	
    [super dealloc];
}

@end
